package or;

import java.util.Arrays;

public class T1652 {
    public int[] decrypt(int[] code, int k) {
        int len = code.length;
        int[] res = new int[len];
        if (k==0){
            return res;
        }
        int left,right;
        if (k>0){
            left=1;
            right=k;
        }else {
            right=len-1;
            left=len+k;
        }
        int sum=0;
        for (int i = left; i <=right ; i++) {
            sum+=code[i];
        }
        for (int i = 0; i <len ; i++) {
            res[i]=sum;
            sum-=code[left];
            left=(left+1)%len;
            sum+=code[right=(right+1)%len];
        }
        return res;
    }
}
